#region Using

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Text;
using EstateNuke.Data;
using Gizmox.WebGUI.Common;
using Gizmox.WebGUI.Forms;

#endregion

namespace EstateNuke.BusinessSystem.Controls.EstateControls
{
    public partial class BuildingTitleLeaseItemControl : UserControl
    {
        private Building _currentBuilding;
        private PropertyState _currentPropertyState;

        public BuildingTitleLeaseItemControl(Building building, PropertyState propertyState)
        {
            _currentBuilding = building;
            _currentPropertyState = propertyState;
            InitializeComponent();
            BindBuildingTitleItem();
        }

        private void BindBuildingTitleItem()
        {
            int propertyCount = _currentBuilding.Properties.Count(c => c.PropertyState == _currentPropertyState);

            lblPropertyCount.Text = propertyCount.ToString();

            pnlPropertyType.BackColor = Color.FromArgb(int.Parse(_currentPropertyState.Color, NumberStyles.HexNumber));
            lblPropertyTypeName.Text = _currentPropertyState.Name;
        }
    }
}